package java_class_work.week08.internet.sendIntDemo;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author Tiam
 * @Date 2022/11/4 18:29
 * @Description:
 */
public class ServerMain {
    public static List<Socket> list = new ArrayList<>();

    public static void main(String[] args) {
        try {
            ServerSocket serverSocket = new ServerSocket(8888);

            Socket socket = null;
            while (true) {
                socket = serverSocket.accept();
                list.add(socket);
                new Thread(new Receive(socket)).start();
                System.out.println("socket地址: " + socket);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
